<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <button id="btn">click</button>
    <button id="sync">sync</button>
    <button id="async">async</button>
    <script>
        btn.addEventListener('click', function () {
            console.log('click')
        })
        sync.addEventListener('click', function () {
            let start = Date.now()
            let end = Date.now()
            while (end - start < 1000 * 10) {
                end = Date.now()
            }
            console.log('end')
        })
        async.addEventListener('click', function () {
            setTimeout(() => {
                console.log('end')
            }, 1000 * 5)
        })
    </script>
</body>

</html>